using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Universe.Farm.Service.Mesages
{
    class SetVisibilityMessage : IMessage
    {
        private MessageHeader _messageHeader;
        private ServicesScope _scope;
        private bool _visible;

        public SetVisibilityMessage()
        {
        }

        public SetVisibilityMessage(MessageHeader messageHeader, ServicesScope scope, bool visible)
        {
            _messageHeader = messageHeader;
            _scope = scope;
            _visible = visible;
        }

        public MessageHeader MessageHeader
        {
            get { return _messageHeader; }
        }

        public ServicesScope Scope
        {
            get { return _scope; }
        }

        public bool Visible
        {
            get { return _visible; }
        }

        void IMessage.Serialize(BinaryWriter writer)
        {
            _messageHeader.Serialize(writer);
            ScopeSerializer.Write(Scope, writer);
            writer.Write(_visible);
        }

        void IMessage.Parse(BinaryReader reader)
        {
            _messageHeader = MessageHeader.Parse(reader);
            _scope = ScopeSerializer.Read(reader);
            _visible = reader.ReadBoolean();
        }
    }
}
